auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void initialize() { if(!customHttpClient) { this.connectionManager = connectionManagerFactory.newConnectionManager( !this.sslHostnameValidationEnabled, this.hostProperties.getMaxTotalConnections(), this.hostProperties.getMaxPerRouteConnections(), this.hostProperties.getTimeToLive(), this.hostProperties.getTimeUnit(), null); this.httpClient = newClient(); this.connectionManagerTimer.schedule(new TimerTask() { @Override public void run() { if (SimpleHostRoutingFilter.this.connectionManager == null) { return; } SimpleHostRoutingFilter.this.connectionManager.closeExpiredConnections(); } }, 30000, 5000); <START> try { <END> HttpServletRequest.class.getMethod("getContentLengthLong"); } catch(NoSuchMethodException e) { useServlet31 = false; } } }</code><technical_language>I this in constructors</technical_language>

Target:
private void initialize() { if(!customHttpClient) { this.connectionManager = connectionManagerFactory.newConnectionManager( !this.sslHostnameValidationEnabled, this.hostProperties.getMaxTotalConnections(), this.hostProperties.getMaxPerRouteConnections(), this.hostProperties.getTimeToLive(), this.hostProperties.getTimeUnit(), null); this.httpClient = newClient(); this.connectionManagerTimer.schedule(new TimerTask() { @Override public void run() { if (SimpleHostRoutingFilter.this.connectionManager == null) { return; } SimpleHostRoutingFilter.this.connectionManager.closeExpiredConnections(); } }, 30000, 5000); } }
Source:
<code>public void encodedData() throws Exception { <START> WebTarget target = client.target(generateURL()); <END> String data = target.path("test/signed/text").request().get(String.class); logger.info(data); client.close(); }</code><technical_language>need remove client.close() this test class is @AfterClass for closing client</technical_language>

Target:
public void encodedData() throws Exception { WebTarget target = client.target(generateURL()); String data = target.path("test/signed/text").request().get(String.class); logger.info(data); }
Source:
<code>public void testParagraphs() throws Exception { CollectionReaderDescription reader = createReaderDescription( ConllUReader.class, ConllUReader.PARAM_LANGUAGE, "en", ConllUReader.PARAM_SOURCE_LOCATION, "src/test/resources/conll/u_v2/", ConllUReader.PARAM_PATTERNS, "conllu-multiple_paragraphs.conll"); JCas jcas = new JCasIterable(reader).iterator().next(); AnnotationIndex<Paragraph> index = jcas.getAnnotationIndex(Paragraph.class); <START> List<String> paragraphIDs = new LinkedList<>(); <END> Iterator<Paragraph> iterator = index.iterator(); while(iterator.hasNext()) { Paragraph p = iterator.next(); paragraphIDs.add(p.getId()); } List<String> expectedParagraphIDs = new ArrayList<String>(){{ add("mf920901-001-p1"); add("mf920901-001-p2"); }}; Assert.assertEquals(expectedParagraphIDs, paragraphIDs); final String expectedTextContent = "Slovenská ústava: pro i proti Slovenská ústava: pro i" + " proti\n" + "\n" + "Slovenská ústava: pro i proti"; final String actualTextContent = jcas.getDocumentText(); Assert.assertEquals(expectedTextContent, actualTextContent); String[] sentences = { "Slovenská ústava: pro i proti", "Slovenská ústava: pro i proti", "Slovenská ústava: pro i proti" }; assertSentence(sentences, select(jcas, Sentence.class)); }</code><technical_language>Normally, ArrayList is a specific reason another list implementation</technical_language>

Target:
public void testParagraphs() throws Exception { CollectionReaderDescription reader = createReaderDescription( ConllUReader.class, ConllUReader.PARAM_LANGUAGE, "en", ConllUReader.PARAM_SOURCE_LOCATION, "src/test/resources/conll/u_v2/", ConllUReader.PARAM_PATTERNS, "conllu-multiple_paragraphs.conll"); JCas jcas = new JCasIterable(reader).iterator().next(); AnnotationIndex<Paragraph> index = jcas.getAnnotationIndex(Paragraph.class); List<String> paragraphIDs = new ArrayList<>(); Iterator<Paragraph> iterator = index.iterator(); while (iterator.hasNext()) { Paragraph p = iterator.next(); paragraphIDs.add(p.getId()); } List<String> expectedParagraphIDs = new ArrayList<String>() { { add("mf920901-001-p1"); add("mf920901-001-p2"); } }; Assert.assertEquals(expectedParagraphIDs, paragraphIDs); final String expectedTextContent = "Slovenská ústava: pro i proti Slovenská ústava: pro i" + " proti\n" + "\n" + "Slovenská ústava: pro i proti"; final String actualTextContent = jcas.getDocumentText(); Assert.assertEquals(expectedTextContent, actualTextContent); String[] sentences = { "Slovenská ústava: pro i proti", "Slovenská ústava: pro i proti", "Slovenská ústava: pro i proti" }; assertSentence(sentences, select(jcas, Sentence.class)); }
Source:
<code>private boolean isIllegalImport(String importText) { boolean isIllegal = false; for (String element : illegalPkgs) { if (importText.startsWith(element + ".")) { <START> isIllegal = true; <END> } } return isIllegal; }</code><technical_language>if result, break out of loop</technical_language>

Target:
private boolean isIllegalImport(String importText) { boolean isIllegal = false; for (String element : illegalPkgs) { if (importText.startsWith(element + ".")) { isIllegal = true; break; } } return isIllegal; }
Source:
<code>protected boolean checkStorageDomainStatusNotEqual(StorageDomainStatus status) { boolean returnValue = false; <START> if (getStorageDomainStatus() != null && getStorageDomainStatus() != null) { <END> returnValue = (getStorageDomainStatus() != status); if (!returnValue) { addStorageDomainStatusIllegalMessage(); } } return returnValue; }</code><technical_language>condition is checked</technical_language>

Target:
protected boolean checkStorageDomainStatusNotEqual(StorageDomainStatus status) { boolean returnValue = false; if (getStorageDomainStatus() != null) { returnValue = (getStorageDomainStatus() != status); if (!returnValue) { addStorageDomainStatusIllegalMessage(); } } return returnValue; }
Source:
<code>protected String getPairs(Map<String, String> data, int page) { StringBuilder pairs = new StringBuilder(); if (data == null || data.isEmpty()) { pairs.append(IGitHubConstants.PARAM_PAGE).append("=").append(page); pairs.append("&"); pairs.append(IGitHubConstants.PARAM_PER_PAGE).append("=") <START> .append(PER_PAGE); <END> } else { int i = 1; for (Entry<String, String> entry : data.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); pairs.append(key).append("=").append(value); if (i < data.size()) { pairs.append("&"); } i++; } } return pairs.toString(); }</code><technical_language>characters ('&') instead of single character string ("&) 4.1 longer NameValuePair class</technical_language>

Target:
protected String getPairs(Map<String, String> data, int page) { StringBuilder pairs = new StringBuilder(); if (data == null || data.isEmpty()) { pairs.append(IGitHubConstants.PARAM_PAGE).append('=').append(page); pairs.append('&'); pairs.append(IGitHubConstants.PARAM_PER_PAGE).append('=') .append(PER_PAGE); } else { int i = 1; for (Entry<String, String> entry : data.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); pairs.append(key).append('=').append(value); if (i < data.size()) pairs.append('&'); i++; } } return pairs.toString(); }
Source:
<code>private static boolean isFeatureFinderMetaboHere(String path) throws FeatureFinderMetaboException { <START> return execShellCommand(path).contains(FEATURE_FINDER_METABO_EVAL); <END> }</code><technical_language>is necessary execute program find if is present. checking for executable file java.io.File.canExecute()</technical_language>

Target:
private static boolean isFeatureFinderMetaboHere(String path) throws MSDKException { return execShellCommand(path).contains(FEATURE_FINDER_METABO_EVAL); }
Source:
<code>public void testGetMcqWeights_allChoicesNull_weightsListShouldBeEmpty() { <START> ______TS("Failure: Weights enabled, null choices, custom weights, other disabled"); <END> FeedbackMcqQuestionDetails mcqDetails = new FeedbackMcqQuestionDetails(); HashMap<String, String[]> requestParams = new HashMap<>(); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_TYPE, new String[] { "MCQ" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_TEXT, new String[] { "mcq question text" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_MCQ_GENERATED_OPTIONS, new String[] { "NONE" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFCHOICECREATED, new String[] { "2" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_MCQ_WEIGHTS_ASSIGNED, new String[] { "on" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_MCQ_WEIGHT + "-0", new String[] { "1.50" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_MCQ_WEIGHT + "-1", new String[] { "2.50" }); assertTrue(mcqDetails.extractQuestionDetails(requestParams, FeedbackQuestionType.MCQ)); assertEquals(mcqDetails.getQuestionType(), FeedbackQuestionType.MCQ); assertTrue(mcqDetails instanceof FeedbackMcqQuestionDetails); assertTrue(mcqDetails.hasAssignedWeights()); assertTrue(mcqDetails.getMcqChoices().isEmpty()); assertTrue(mcqDetails.getMcqWeights().isEmpty()); assertFalse(mcqDetails.getOtherEnabled()); assertEquals(0.0, mcqDetails.getMcqOtherWeight()); }</code><technical_language>need ______TS method name is telling story</technical_language>

Target:
public void testGetMcqWeights_allChoicesNull_weightsListShouldBeEmpty() { FeedbackMcqQuestionDetails mcqDetails = new FeedbackMcqQuestionDetails(); HashMap<String, String[]> requestParams = new HashMap<>(); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_TYPE, new String[] { "MCQ" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_TEXT, new String[] { "mcq question text" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_MCQ_GENERATED_OPTIONS, new String[] { "NONE" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFCHOICECREATED, new String[] { "2" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_MCQ_HAS_WEIGHTS_ASSIGNED, new String[] { "on" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_MCQ_WEIGHT + "-0", new String[] { "1.50" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_MCQ_WEIGHT + "-1", new String[] { "2.50" }); assertTrue(mcqDetails.extractQuestionDetails(requestParams, FeedbackQuestionType.MCQ)); assertEquals(mcqDetails.getQuestionType(), FeedbackQuestionType.MCQ); assertTrue(mcqDetails instanceof FeedbackMcqQuestionDetails); assertTrue(mcqDetails.hasAssignedWeights()); assertTrue(mcqDetails.getMcqChoices().isEmpty()); assertTrue(mcqDetails.getMcqWeights().isEmpty()); assertFalse(mcqDetails.getOtherEnabled()); assertEquals(0.0, mcqDetails.getMcqOtherWeight()); }
Source:
<code>public final ClientBuilder connectTimeout(long connectTimeout, TimeUnit unit) { if (thisConnectTimeout.isPresent()) { <START> Preconditions.checkArgument(!thisConnectTimeout.isPresent(), "connectTimeout already set"); <END> } thisConnectTimeout = Optional.of(Duration.millis(TimeUnit.MILLISECONDS.convert(connectTimeout, unit))); return this; }</code><technical_language>if statement, this is true</technical_language>

Target:
public final ClientBuilder connectTimeout(long connectTimeout, TimeUnit unit) { Preconditions.checkArgument(!thisConnectTimeout.isPresent(), "connectTimeout already set"); thisConnectTimeout = Optional.of(Duration.millis(TimeUnit.MILLISECONDS.convert(connectTimeout, unit))); return this; }
Source:
<code>private <R> R performWithConnection(Function<Object, R> function) { Optional<MutableConfigurationStats> stats = getMutableConfigurationStats(executionContext); RetryPolicyTemplate retryPolicy = (RetryPolicyTemplate) executionContext.getRetryPolicyTemplate().orElseGet(NoRetryPolicyTemplate::new); CompletableFuture<R> future = retryPolicy.applyPolicy(() -> completedFuture(withConnection(function)), e -> shouldRetry(e, executionContext), e -> { }, <START> e -> stats.ifPresent(s -> s.discountInflightOperation()), <END> identity(), executionContext.getCurrentScheduler()); try { return future.get(); } catch (Exception e) { throw new MuleRuntimeException(createStaticMessage(COULD_NOT_RECONNECT), e); } }</code><technical_language>This is repeated code mediator... lines 92 100 part of ReconnectionUtils class created a static method receives CompletableFuture is in mediator</technical_language>

Target:
private <R> R performWithConnection(Function<Object, R> function) { Optional<MutableConfigurationStats> stats = getMutableConfigurationStats(executionContext); RetryPolicyTemplate retryPolicy = (RetryPolicyTemplate) executionContext.getRetryPolicyTemplate().orElseGet(NoRetryPolicyTemplate::new); CompletableFuture<R> future = retryPolicy.applyPolicy(() -> completedFuture(withConnection(function)), e -> !isFirstPage && !delegate.useStickyConnections() && shouldRetry(e, executionContext), e -> { }, e -> stats.ifPresent(s -> s.discountInflightOperation()), identity(), executionContext.getCurrentScheduler()); try { return future.get(); } catch (Exception e) { throw new MuleRuntimeException(createStaticMessage(COULD_NOT_EXECUTE), e); } }
Source:
<code>public Storage.Buckets.Delete deleteBucketRequest(String bucket) throws IOException { <START> return storage.buckets().delete(bucket); <END> }</code><technical_language>Currently yes. prudent current case future uses. defensively in cases. need for preconditions throughout</technical_language>

Target:
public Storage.Buckets.Delete deleteBucketRequest(String bucket) throws IOException { Preconditions.checkArgument(!Strings.isNullOrEmpty(bucket)); return storage.buckets().delete(bucket); }
Source:
<code>public void testDefaultNormalizerEmailURL() { <START> String[] testSentence = new String[] {"a", "abc0io@examlpe.com", "c", "d", <END> "e", "f", "<LINK_0>", "h"}; String[] testResult = new String[] {"a", "$EMAIL$", "c", "d", "e", "f", "$URL$", "h"}; TokenNormalizerFeatureGenerator featureGenerator = new TokenNormalizerFeatureGenerator(new IdentityFeatureGenerator()); for (int i = 0; i < testSentence.length; i++) { featureGenerator.createFeatures(features, testSentence, i, null); Assert.assertEquals(features.get(i), testResult[i]); } }</code><technical_language>Nitpick: typo in 'example'</technical_language>

Target:
public void testDefaultNormalizerEmailURL() { String[] testSentence = new String[] {"a", "abc0io@example.com", "c", "d", "e", "f", "<LINK_0>", "h"}; String[] testResult = new String[] {"a", "$EMAIL$", "c", "d", "e", "f", "$URL$", "h"}; TokenNormalizerFeatureGenerator featureGenerator = new TokenNormalizerFeatureGenerator(new IdentityFeatureGenerator()); List<String> features = new ArrayList<>(); for (int i = 0; i < testSentence.length; i++) { featureGenerator.createFeatures(features, testSentence, i, null); Assert.assertEquals(features.get(i), testResult[i]); } }
Source:
<code>public static TestingSemiTransactionalHiveMetastore create() { HiveClientConfig config = new HiveClientConfig(); HdfsConfiguration hdfsConfiguration = new HiveHdfsConfiguration(new HdfsConfigurationInitializer(config), ImmutableSet.of()); HdfsEnvironment hdfsEnvironment = new HdfsEnvironment(hdfsConfiguration, config, new NoHdfsAuthentication()); <START> HiveCluster hiveCluster = new TestingHiveCluster(config, "dummy", 1111); <END> ExtendedHiveMetastore delegate = new BridgingHiveMetastore(new ThriftHiveMetastore(hiveCluster)); ExecutorService executor = newCachedThreadPool(daemonThreadsNamed("hive-%s")); ListeningExecutorService renameExecutor = listeningDecorator(executor); return new TestingSemiTransactionalHiveMetastore(hdfsEnvironment, delegate, renameExecutor, false, false); }</code><technical_language>put "dummy" 1111 static constants</technical_language>

Target:
public static TestingSemiTransactionalHiveMetastore create() { HiveClientConfig config = new HiveClientConfig(); HdfsConfiguration hdfsConfiguration = new HiveHdfsConfiguration(new HdfsConfigurationInitializer(config), ImmutableSet.of()); HdfsEnvironment hdfsEnvironment = new HdfsEnvironment(hdfsConfiguration, config, new NoHdfsAuthentication()); HiveCluster hiveCluster = new TestingHiveCluster(config, HOST, PORT); ExtendedHiveMetastore delegate = new BridgingHiveMetastore(new ThriftHiveMetastore(hiveCluster)); ExecutorService executor = newCachedThreadPool(daemonThreadsNamed("hive-%s")); ListeningExecutorService renameExecutor = listeningDecorator(executor); return new TestingSemiTransactionalHiveMetastore(hdfsEnvironment, delegate, renameExecutor, false, false); }
Source:
<code>default List<T> intersperse(T element) { return isEmpty() ? Nil.instance() <START> : foldRight(empty(), (x, xs) -> xs.isEmpty() ? xs.prepend(x) : xs.prepend(element).prepend(x)); <END> }</code><technical_language>I ask if omit isEmpty check, this: java if (isEmpty()) { return this; } else { final List<T> = reverse(); return that.tail().foldLeft(of(head()), (x, xs) -> xs.prepend(element).prepend(x)); }</technical_language>

Target:
default List<T> intersperse(T element) { return ofAll(iterator().intersperse(element)); }
Source:
<code>private boolean isProtocolNameInconsistent(String protocolName) { <START> return protocolName != null && !protocolName.equals(generation().protocol); <END> }</code><technical_language>change Generation.protocol protocolName well</technical_language>

Target:
private boolean isProtocolNameInconsistent(String protocolName) { return protocolName != null && !protocolName.equals(generation().protocolName); }
Source:
<code>public String toString(){ if (this.extra == null) { <START> return "NullInfoRegistry<" + this.nullBit1 + this.nullBit2 + this.nullBit3 + this.nullBit4 + ">"; END> } else { StringBuilder sb = new StringBuilder("NullInfoRegistry<["); sb.append(this.nullBit1); sb.append(this.nullBit2); sb.append(this.nullBit3); sb.append(this.nullBit4); int i, ceil; for (i = 0, ceil = this.extra[0].length > 3 ? 3 : this.extra[0].length; i < ceil; i++) { sb.append(","); sb.append(this.extra[2][i]); sb.append(this.extra[3][i]); sb.append(this.extra[4][i]); sb.append(this.extra[5][i]); } if (ceil < this.extra[0].length) { sb.append(",..."); } sb.append("]>"); return sb.toString(); } }</code><technical_language>StringBuilder here</technical_language>

Target:
public String toString(){ if (this.extra == null) { StringBuilder sb = new StringBuilder("NullInfoRegistry<"); sb.append(this.nullBit1); sb.append(this.nullBit2); sb.append(this.nullBit3); sb.append(this.nullBit4); sb.append(">"); return sb.toString(); } else { StringBuilder sb = new StringBuilder("NullInfoRegistry<["); sb.append(this.nullBit1); sb.append(this.nullBit2); sb.append(this.nullBit3); sb.append(this.nullBit4); int i, ceil; for (i = 0, ceil = this.extra[0].length > 3 ? 3 : this.extra[0].length; i < ceil; i++) { sb.append(","); sb.append(this.extra[2][i]); sb.append(this.extra[3][i]); sb.append(this.extra[4][i]); sb.append(this.extra[5][i]); } if (ceil < this.extra[0].length) { sb.append(",..."); } sb.append("]>"); return sb.toString(); } }
Source:
<code>private static Looper newLooper(boolean canQuit) { return ReflectionHelpers.callConstructor( <START> Looper.class, ReflectionHelpers.ClassParameter.from(boolean.class, canQuit)); <END> }</code><technical_language>nit: change of ClassParameter.from? require importing import org.robolectric.util.ReflectionHelpers.ClassParameter. common pattern in Robolectric</technical_language>

Target:
private static Looper newLooper(boolean canQuit) { return ReflectionHelpers.callConstructor( Looper.class, ClassParameter.from(boolean.class, canQuit)); }
Source:
<code>public DBObject getSortObject() { <START> BasicDBObject sort = (BasicDBObject) getOptions().getSortDBObject(); <END> return (sort == null) ? null : new BasicDBObject(sort); }</code><technical_language>casts BasicDBObject in this class unsafe removed</technical_language>

Target:
public DBObject getSortObject() { DBObject sort = getOptions().getSortDBObject(); return (sort == null) ? null : new BasicDBObject(sort.toMap()); }
Source:
<code>private void simulateFileUpload(final String mediaId, final String mediaUrl) { Thread thread = new Thread() { @Override public void run() { try { float count = (float) 0.1; while (count < 1.1) { sleep(500); <START> ((EditorMediaUploadListener) mEditorFragment).onMediaUploadProgress(mediaId, false, count); <END> count += 0.1; } MediaFile mediaFile = new MediaFile(); mediaFile.setMediaId(MEDIA_REMOTE_ID_SAMPLE); mediaFile.setFileURL(mediaUrl); ((EditorMediaUploadListener) mEditorFragment).onMediaUploadSucceeded(mediaId, mediaFile); if (mFailedUploads.containsKey(mediaId)) { mFailedUploads.remove(mediaId); } } catch (InterruptedException e) { e.printStackTrace(); } } }; thread.start(); }</code><technical_language>false param anymore (onMediaUploadProgress changed) - in more places in this class</technical_language>

Target:
private void simulateFileUpload(final String mediaId, final String mediaUrl) { Thread thread = new Thread() { @Override public void run() { try { float count = (float) 0.1; while (count < 1.1) { sleep(500); ((EditorMediaUploadListener) mEditorFragment).onMediaUploadProgress(mediaId, count); count += 0.1; } MediaFile mediaFile = new MediaFile(); mediaFile.setMediaId(MEDIA_REMOTE_ID_SAMPLE); mediaFile.setFileURL(mediaUrl); ((EditorMediaUploadListener) mEditorFragment).onMediaUploadSucceeded(mediaId, mediaFile); if (mFailedUploads.containsKey(mediaId)) { mFailedUploads.remove(mediaId); } } catch (InterruptedException e) { e.printStackTrace(); } } }; thread.start(); }
Source:
<code>private static Optional<FirstStrikeStepOrder> calculateAttackerSteps( final @NonNull BattleState battleState) { final ReturnFire returnFireAgainstAttackingSubs = returnFireAgainstAttackingSubs( battleState.getAttackingUnits(), battleState.getDefendingUnits(), battleState.getGameData()); switch (returnFireAgainstAttackingSubs) { case ALL: return Optional.of(OFFENDER_NO_SNEAK_ATTACK); case SUBS: return Optional.of(OFFENDER_SNEAK_ATTACK_WITH_OPPOSING_FIRST_STRIKE); case NONE: return Optional.of(OFFENDER_SNEAK_ATTACK); default: <START> return Optional.empty(); <END> } }</code><technical_language>Do expect other options? If no, throwing exception valuable in case fail update this list. considered "polymorphic switch" refactor (I forget real name for kind of update), potentially remove switch statement. EG: returnFireAgainstAttackingSubs.getFirstStrikeStepOrder() Though, I do get a circular dependency. This implies a static lookup method enum do trick, eg: public static Optional<FirstStrikeStepOrder> lookupByReturnFireType(ReturnFire returnFire) { return Arrays.stream(values()) .filter(firstStrikeStepOrder -> firstStrikeStepOrder.returnFire == returnFire) .findAny(); } Yet, I duplicated offender attacker. considered splitting enum two, for attacker another for deferender? In a case encode attacker defender in enum name. get attacker defender a flag do need enum values. WDYT</technical_language>

Target:
private static FirstStrikeStepOrder calculateAttackerSteps( final @NonNull BattleState battleState) { final ReturnFire returnFireAgainstAttackingSubs = returnFireAgainstAttackingSubs( battleState.getAttackingUnits(), battleState.getDefendingUnits(), battleState.getGameData()); switch (returnFireAgainstAttackingSubs) { case ALL: return OFFENDER_NO_SNEAK_ATTACK; case SUBS: return OFFENDER_SNEAK_ATTACK_WITH_OPPOSING_FIRST_STRIKE; case NONE: return OFFENDER_SNEAK_ATTACK; default: return NOT_APPLICABLE; } }
Source:
<code>protected boolean validateContent(AzureBlobFileSystem fs, Path path, byte[] originalByteArray) throws IOException { FSDataInputStream in = fs.open(path); byte[] contentByteArray = new byte[originalByteArray.length]; int seekPos = 0; <START> while (in.read() != -1) { <END> in.seek(seekPos); contentByteArray[seekPos] = (byte) (in.read()); seekPos++; } return Arrays.equals(contentByteArray, originalByteArray); }</code><technical_language>read() moves stream forward, need seek/seekPos++; slow</technical_language>

Target:
protected boolean validateContent(AzureBlobFileSystem fs, Path path, byte[] originalByteArray) throws IOException { int pos = 0; int lenOfOriginalByteArray = originalByteArray.length; try (FSDataInputStream in = fs.open(path)) { byte valueOfContentAtPos = (byte) in.read(); while (valueOfContentAtPos != -1 && pos < lenOfOriginalByteArray) { if (originalByteArray[pos] != valueOfContentAtPos) { assertEquals("Mismatch in content validation at position {}", pos, originalByteArray[pos], valueOfContentAtPos); return false; } valueOfContentAtPos = (byte) in.read(); pos++; } if (valueOfContentAtPos != -1) { assertEquals("Expected end of file", -1, valueOfContentAtPos); return false; } return true; } }
Source:
<code>public void decide(Authentication authentication, Object object, Collection<ConfigAttribute> configAttributes) throws AccessDeniedException, InsufficientAuthenticationException { <START> if (session.getAccesstoken() == null) <END> throw new AccessDeniedException("There is no accesstoken in session!"); }</code><technical_language>Code Style: surround blocks curly braces, liners</technical_language>

Target:
public void decide(Authentication authentication, Object object, Collection<ConfigAttribute> configAttributes) throws AccessDeniedException, InsufficientAuthenticationException { if (session.getAccesstoken() == null) { throw new AccessDeniedException("There is no accesstoken in session!"); } }
Source:
<code>private List<FieldInfo> processSasFile(String filename) { StringUtilities.outputWithTime("Scanning table " + filename); List<FieldInfo> fieldInfos = new ArrayList<>(); FileInputStream inputStream; try { inputStream = new FileInputStream(new File(filename)); SasFileReader sasFileReader = new SasFileReaderImpl(inputStream); SasFileProperties sasFileProperties = sasFileReader.getSasFileProperties(); for (Column column : sasFileReader.getColumns()) { fieldInfos.add(new FieldInfo(column.getName())); } for (int i = 0; i < sasFileProperties.getRowCount(); i++) { Object[] row = sasFileReader.readNext(); if (row.length == fieldInfos.size()) { for (int j = 0; j < row.length; j++) { fieldInfos.get(j).processValue(row[j] == null ? "" : row[j].toString()); } } <START> if (sampleSize != -1 && i == sampleSize) <END> break; } inputStream.close(); } catch (IOException e) { e.printStackTrace(); } for (FieldInfo fieldInfo : fieldInfos) { fieldInfo.trim(); } return fieldInfos; }</code><technical_language>Note: sampleSize != -1 is redundant, if sampleSize == -1, i == sampleSize is false</technical_language>

Target:
private List<FieldInfo> processSasFile(String filename) { StringUtilities.outputWithTime("Scanning table " + filename); List<FieldInfo> fieldInfos = new ArrayList<>(); try(FileInputStream inputStream = new FileInputStream(new File(filename))) { SasFileReader sasFileReader = new SasFileReaderImpl(inputStream); SasFileProperties sasFileProperties = sasFileReader.getSasFileProperties(); for (Column column : sasFileReader.getColumns()) { fieldInfos.add(new FieldInfo(column.getName())); } for (int lineNr = 0; lineNr < sasFileProperties.getRowCount(); lineNr++) { Object[] row = sasFileReader.readNext(); if (row.length == fieldInfos.size()) { for (int i = 0; i < row.length; i++) { fieldInfos.get(i).processValue(row[i] == null ? "" : row[i].toString()); } } if (lineNr == sampleSize) break; } inputStream.close(); } catch (IOException e) { e.printStackTrace(); } for (FieldInfo fieldInfo : fieldInfos) { fieldInfo.trim(); } return fieldInfos; }
Source:
<code><START> public default void inc() { <END> inc(1); }</code><technical_language>public keyword is needed in interfaces. of public default</technical_language>

Target:
default void inc() { inc(1); }
Source:
<code>protected abstract void remoteGetBeforeWrite(InvocationContext ctx, WriteCommand command, Object key) throws Throwable; protected boolean readNeedsRemoteGet(InvocationContext ctx, AbstractDataCommand command) { if (command.hasFlag(Flag.CACHE_MODE_LOCAL) || command.hasFlag(Flag.SKIP_REMOTE_LOOKUP)) { return false; } Object key = command.getKey(); <START> ConsistentHash ch = stateTransferManager.getCacheTopology().getReadConsistentHash(); <END> boolean shouldFetchFromRemote = ctx.isOriginLocal() && !isValueAvailableLocally(ch, key); if (!shouldFetchFromRemote && getLog().isTraceEnabled()) { getLog().tracef("Not doing a remote get for key %s since entry is mapped to current node (%s) or is in L1. Owners are %s", toStr(key), rpcManager.getAddress(), ch.locateOwners(key)); } return shouldFetchFromRemote; }</code><technical_language>This is used. do !isValueAvailableLocally(stateTransferManager.getCacheTopology().getReadConsistentHash(), key); assign in if block below</technical_language>

Target:
protected abstract void remoteGetBeforeWrite(InvocationContext ctx, WriteCommand command, Object key) throws Throwable; protected boolean readNeedsRemoteValue(InvocationContext ctx, AbstractDataCommand command) { if (!ctx.isOriginLocal() || command.hasFlag(Flag.CACHE_MODE_LOCAL) || command.hasFlag(Flag.SKIP_REMOTE_LOOKUP)) { return false; } Object key = command.getKey(); ConsistentHash ch = stateTransferManager.getCacheTopology().getReadConsistentHash(); boolean shouldFetchFromRemote = !isValueAvailableLocally(ch, key); if (!shouldFetchFromRemote && getLog().isTraceEnabled()) { getLog().tracef("Not doing a remote get for key %s since entry is mapped to current node (%s) or is in L1. Owners are %s", toStr(key), rpcManager.getAddress(), ch.locateOwners(key)); } return shouldFetchFromRemote; }
Source:
<code>private void configureImageButton(ThemeViewHolder themeViewHolder, final String themeId, final boolean isPremium, boolean isCurrent) { final PopupMenu popupMenu = new PopupMenu(mContext, themeViewHolder.mImageButton); popupMenu.getMenuInflater().inflate(R.menu.theme_more, popupMenu.getMenu()); configureMenuForTheme(popupMenu.getMenu(), isCurrent); popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { int i = item.getItemId(); if (i == R.id.menu_activate) { <START> if (!isPremium || (mSitePlanId == PlansConstants.PREMIUM_PLAN_ID <END> || mSitePlanId == PlansConstants.BUSINESS_PLAN_ID)) { mCallback.onActivateSelected(themeId); } else { mCallback.onDetailsSelected(themeId); } } else if (i == R.id.menu_try_and_customize) { mCallback.onTryAndCustomizeSelected(themeId); } else if (i == R.id.menu_view) { mCallback.onViewSelected(themeId); } else if (i == R.id.menu_details) { mCallback.onDetailsSelected(themeId); } else { mCallback.onSupportSelected(themeId); } return true; } }); themeViewHolder.mImageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { popupMenu.show(); } }); }</code><technical_language>move this conditional method please? a bit hard understand context</technical_language>

Target:
private void configureImageButton(ThemeViewHolder themeViewHolder, final String themeId, final boolean isPremium, boolean isCurrent) { final PopupMenu popupMenu = new PopupMenu(mContext, themeViewHolder.mImageButton); popupMenu.getMenuInflater().inflate(R.menu.theme_more, popupMenu.getMenu()); configureMenuForTheme(popupMenu.getMenu(), isCurrent); popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { int i = item.getItemId(); if (i == R.id.menu_activate) { if (canActivateThemeDirectly(isPremium, mSitePlanId)) { mCallback.onActivateSelected(themeId); } else { mCallback.onDetailsSelected(themeId); } } else if (i == R.id.menu_try_and_customize) { mCallback.onTryAndCustomizeSelected(themeId); } else if (i == R.id.menu_view) { mCallback.onViewSelected(themeId); } else if (i == R.id.menu_details) { mCallback.onDetailsSelected(themeId); } else { mCallback.onSupportSelected(themeId); } return true; } }); themeViewHolder.mImageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { popupMenu.show(); } }); }
Source:
<code>public List<User> getUsers() { <START> return Collections.unmodifiableList(mConnectedUsers); <END> }</code><technical_language>If list of users stays same, unmodifiable in class constructor</technical_language>

Target:
public List<User> getUsers() { return Collections.unmodifiableList(mUsers); }
Source:
<code>public void addResourceHandlers(ResourceHandlerRegistry registry) { <START> registry.addResourceHandler("/gui/**").addResourceLocations("/WEB-INF/static/"); <END> super.addResourceHandlers(registry); }</code><technical_language>accessing /gui, of resources reached. log hints why: Feb 14, 2014 11:27:38 org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler INFO: Mapped URL path [/gui] handler '/gui' Feb 14, 2014 11:27:38 org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler INFO: Mapped URL path [/gui/**] handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] this resourcehandler mapping</technical_language>

Target:
public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/gui/**").addResourceLocations("/WEB-INF/static/"); registry.addResourceHandler("/webjars/**").addResourceLocations("/webjars/"); super.addResourceHandlers(registry); }
Source:
<code>public void testListDataSetsBasics() { TestClusterPartitionReleaser partitionReleaser = new TestClusterPartitionReleaser(); final ResourceManagerPartitionTracker tracker = new ResourceManagerPartitionTrackerImpl(partitionReleaser); <START> assertEquals(0, tracker.listDataSets().size()); <END> tracker.processTaskExecutorClusterPartitionReport( TASK_EXECUTOR_ID_1, createClusterPartitionReport(DATA_SET_ID, 1, PARTITION_ID_1)); final Map<IntermediateDataSetID, DataSetMetaInfo> listing = tracker.listDataSets(); assertThat(listing, hasKey(DATA_SET_ID)); DataSetMetaInfo metaInfo = listing.get(DATA_SET_ID); assertEquals(1, metaInfo.getNumTotalPartitions()); tracker.processTaskExecutorClusterPartitionReport( TASK_EXECUTOR_ID_1, EMPTY_PARTITION_REPORT); assertEquals(0, tracker.listDataSets().size()); }</code><technical_language>suggestion assertThat(tracker.listDataSets().size(), is(0)); minor: do this for readability</technical_language>

Target:
public void testListDataSetsBasics() { final ResourceManagerPartitionTrackerImpl tracker = new ResourceManagerPartitionTrackerImpl(new TestClusterPartitionReleaser()); assertThat(tracker.listDataSets().size(), is(0)); report(tracker, TASK_EXECUTOR_ID_1, DATA_SET_ID, 1, PARTITION_ID_1); final Map<IntermediateDataSetID, DataSetMetaInfo> listing = tracker.listDataSets(); assertThat(listing, hasKey(DATA_SET_ID)); DataSetMetaInfo metaInfo = listing.get(DATA_SET_ID); assertThat(metaInfo.getNumTotalPartitions(), is(1)); reportEmpty(tracker, TASK_EXECUTOR_ID_1); assertThat(tracker.listDataSets().size(), is(0)); assertThat(tracker.areAllMapsEmpty(), is(true)); }
Source:
<code>public void testRebindCheckingMemoryLeak() throws Exception { TestEntity c1 = origApp.addChild(EntitySpec.create(TestEntity.class)); Entities.manage(c1); c1.setConfig(TestEntity.CONF_NAME, Strings.makeRandomId(1000000)); gcAndLog("before"); <START> long used0 = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); <END> for (int i=0; i<500; i++) { doPartialRebindOfIds(c1.getId()); origManagementContext.getGarbageCollector().gcIteration(); gcAndLog("iteration "+i); if (i==5) used0 = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); } gcAndLog("after"); long used1 = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); Assert.assertTrue(used1 - used0 < 5000000, "Expected leak of less than 5M; leak was: from "+Strings.makeJavaSizeString(used0)+" to "+Strings.makeJavaSizeString(used1)); }</code><technical_language>Minor preference: set assign this -1 some such, overwritten i==5</technical_language>

Target:
public void testRebindCheckingMemoryLeak() throws Exception { TestEntity c1 = origApp.addChild(EntitySpec.create(TestEntity.class)); Entities.manage(c1); c1.setConfig(TestEntity.CONF_NAME, Strings.makeRandomId(1000000)); gcAndLog("before"); long used0 = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); for (int i=0; i<200; i++) { doPartialRebindOfIds(c1.getId()); origManagementContext.getGarbageCollector().gcIteration(); gcAndLog("iteration "+i); if (i==5) used0 = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); } gcAndLog("after"); long used1 = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); Assert.assertTrue(used1 - used0 < 5000000, "Expected leak of less than 5M; leak was: from "+Strings.makeJavaSizeString(used0)+" to "+Strings.makeJavaSizeString(used1)); }
Source:
<code>public SortedSet<String> getJobNames() { <START> return jobNames; <END> }</code><technical_language>Also, defeats synchronization attempts. Returning a copy option</technical_language>

Target:
public Set<String> getJobNames() { return Collections.unmodifiableSet(jobNames); }
Source:
<code><START> public void start() { <END> super.start(); try { connection = datasourceJNDILocation != null ? DatabaseBinaryStore.connect(datasourceJNDILocation) : DatabaseBinaryStore.connect(driverClass, connectionURL, username, password); if (!tableExists()) { createTable(); } } catch (BinaryStoreException e) { throw new RuntimeException(e); } }</code><technical_language>I if throw BinaryStoreException in base class, wrap exception in a RuntimeException</technical_language>

Target:
public void start() { super.start(); try { Connection connection = datasourceJNDILocation != null ? DatabaseBinaryStore.connect(datasourceJNDILocation) : DatabaseBinaryStore.connect(driverClass, connectionURL, username, password); DatabaseMetaData metaData = connection.getMetaData(); database = new Database(connection); if (!database.tableExists()) { database.createTable(); } } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>public ChannelFuture goAway(final ChannelHandlerContext ctx, final int lastStreamId, final long errorCode, final ByteBuf debugData, ChannelPromise promise) { promise = promise.unvoid(); final Http2Connection connection = connection(); try { if (!connection.goAwaySent(lastStreamId, errorCode, debugData)) { debugData.release(); promise.trySuccess(); return promise; } } catch (Throwable cause) { debugData.release(); promise.tryFailure(cause); return promise; } <START> ctx.fireUserEventTriggered(new Http2GoAwaySentEvent(lastStreamId, errorCode)); <END> debugData.retain(); ChannelFuture future = frameWriter().writeGoAway(ctx, lastStreamId, errorCode, debugData, promise); if (future.isDone()) { processGoAwayWriteResult(ctx, lastStreamId, errorCode, debugData, future); } else { future.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { processGoAwayWriteResult(ctx, lastStreamId, errorCode, debugData, future); } }); } return future; }</code><technical_language>is generally useful right ? for child channel / frame API. I this sense in commit message sounds useful for people child channel. API. clarify a bit in commit message</technical_language>

Target:
public ChannelFuture goAway(final ChannelHandlerContext ctx, final int lastStreamId, final long errorCode, final ByteBuf debugData, ChannelPromise promise) { promise = promise.unvoid(); final Http2Connection connection = connection(); try { if (!connection.goAwaySent(lastStreamId, errorCode, debugData)) { debugData.release(); promise.trySuccess(); return promise; } } catch (Throwable cause) { debugData.release(); promise.tryFailure(cause); return promise; } ctx.fireUserEventTriggered(new Http2GoAwayWriteEvent(lastStreamId, errorCode)); debugData.retain(); ChannelFuture future = frameWriter().writeGoAway(ctx, lastStreamId, errorCode, debugData, promise); if (future.isDone()) { processGoAwayWriteResult(ctx, lastStreamId, errorCode, debugData, future); } else { future.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { processGoAwayWriteResult(ctx, lastStreamId, errorCode, debugData, future); } }); } return future; }
Source:
<code>private LocalCheckpointTracker createLocalCheckpointTracker( BiFunction<Long, Long, LocalCheckpointTracker> localCheckpointTrackerSupplier) throws IOException { final long maxSeqNo; final long localCheckpoint; final SequenceNumbers.CommitInfo seqNoStats = SequenceNumbers.loadSeqNoInfoFromLuceneCommit(store.readLastCommittedSegmentsInfo().userData.entrySet()); maxSeqNo = seqNoStats.maxSeqNo; localCheckpoint = seqNoStats.localCheckpoint; <START> logger.trace("recovered maximum sequence number and local checkpoint [{}]", maxSeqNo, localCheckpoint); <END> return localCheckpointTrackerSupplier.apply(maxSeqNo, localCheckpoint); }</code><technical_language>wrap in logger.isTraceEnabled</technical_language>

Target:
private LocalCheckpointTracker createLocalCheckpointTracker( BiFunction<Long, Long, LocalCheckpointTracker> localCheckpointTrackerSupplier) throws IOException { final long maxSeqNo; final long localCheckpoint; final SequenceNumbers.CommitInfo seqNoStats = SequenceNumbers.loadSeqNoInfoFromLuceneCommit(store.readLastCommittedSegmentsInfo().userData.entrySet()); maxSeqNo = seqNoStats.maxSeqNo; localCheckpoint = seqNoStats.localCheckpoint; if (logger.isTraceEnabled()) { logger.trace("recovered maximum sequence number and local checkpoint [{}]", maxSeqNo, localCheckpoint); } return localCheckpointTrackerSupplier.apply(maxSeqNo, localCheckpoint); }
Source:
<code>private synchronized void onReceiverCompleted(final String receiverId) { stateMachine.checkState(CAN_SEND); receiverStateMachineMap.get(receiverId) .checkAndSetState(PushShuffleReceiverState.RECEIVING, PushShuffleReceiverState.COMPLETED); numCompletedReceivers++; LOG.log(Level.FINE, "A receiver " + receiverId + " was completed to receive data."); if (numCompletedReceivers == totalNumReceivers) { numCompletedReceivers = 0; stateMachine.checkAndSetState(CAN_SEND, RECEIVERS_COMPLETED); LOG.log(Level.INFO, "All receivers were completed to receive data."); <START> if (pushShuffleListener != null) { <END> pushShuffleListener.onIterationCompleted(++numCompletedIterations); } if (shutdown) { shutdownAllSendersAndReceivers(); } else { broadcastToReceivers(PushShuffleCode.RECEIVER_CAN_RECEIVE); } } }</code><technical_language>a NullObject performs in onIterationCompleted? get rid of null check</technical_language>

Target:
private synchronized void onReceiverCompleted(final String receiverId) { stateMachine.checkState(CAN_SEND); receiverStateMachineMap.get(receiverId) .checkAndSetState(PushShuffleReceiverState.RECEIVING, PushShuffleReceiverState.COMPLETED); numCompletedReceivers++; LOG.log(Level.FINE, "A receiver " + receiverId + " was completed to receive data."); if (numCompletedReceivers == totalNumReceivers) { numCompletedReceivers = 0; stateMachine.checkAndSetState(CAN_SEND, RECEIVERS_COMPLETED); LOG.log(Level.INFO, "All receivers were completed to receive data."); pushShuffleListener.onIterationCompleted(++numCompletedIterations); if (shutdown) { shutdownAllSendersAndReceivers(); } else { broadcastToReceivers(PushShuffleCode.RECEIVER_CAN_RECEIVE); } } }
Source:
<code>synchronized void updateLease(Lease newLease) { <START> this.lease = newLease; <END> }</code><technical_language>some precondition like, updating lease if advantageous do so? E.g. if update past, great</technical_language>

Target:
synchronized void updateLease(Lease newLease) { Preconditions.checkArgument(newLease.leaseOwnerId().equals(lease.leaseOwnerId()), "Lock leases can only be refreshed by lease owners"); if (this.lease.expiry().isBefore(newLease.expiry())) { this.lease = newLease; } }
Source:
<code>RouterNetworkComponentsFactory(NetworkMetrics networkMetrics, NetworkConfig networkConfig, SSLFactory sslFactory, int maxConnectionsPerPortPlainText, int maxConnectionsPerPortSsl, Time time) { <START> if (networkMetrics == null || networkConfig == null) { <END> throw new IllegalArgumentException("Invalid inputs passed in, NetworkMetrics: " + networkMetrics + " " + "NetworkConfig: " + networkConfig); } this.networkMetrics = networkMetrics; this.networkConfig = networkConfig; this.sslFactory = sslFactory; this.maxConnectionsPerPortPlainText = maxConnectionsPerPortPlainText; this.maxConnectionsPerPortSsl = maxConnectionsPerPortSsl; this.time = time; }</code><technical_language>skip this check? this a package private class</technical_language>

Target:
RouterNetworkComponentsFactory(NetworkMetrics networkMetrics, NetworkConfig networkConfig, SSLFactory sslFactory, int maxConnectionsPerPortPlainText, int maxConnectionsPerPortSsl, Time time) { this.networkMetrics = networkMetrics; this.networkConfig = networkConfig; this.sslFactory = sslFactory; this.maxConnectionsPerPortPlainText = maxConnectionsPerPortPlainText; this.maxConnectionsPerPortSsl = maxConnectionsPerPortSsl; this.time = time; }
Source:
<code>public void testProcessWithMissingRequiredVariable() throws Exception { <START> KieBase kbase = createKnowledgeBase("variable-tags/approval-with-required-variable-tags.bpmn2"); KieSession ksession = createKnowledgeSession(kbase); TestWorkItemHandler workItemHandler = new TestWorkItemHandler(); ksession.getWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler); <END> assertThatExceptionOfType(VariableViolationException.class).isThrownBy(() -> ksession.startProcess("approvals")); ksession.dispose(); }</code><technical_language>This block is common tests in this class extracted a private method, parameterizing name of process</technical_language>

Target:
public void testProcessWithMissingRequiredVariable() throws Exception { ksession = createSessionAndRegisterWorkItemHandler("variable-tags/approval-with-required-variable-tags.bpmn2"); assertThatExceptionOfType(VariableViolationException.class).isThrownBy(() -> ksession.startProcess("approvals")); }
Source:
<code>public ChainrEntry( int index, Object chainrEntryObj ) { if ( ! (chainrEntryObj instanceof Map ) ) { <START> throw new SpecException( "JOLT Chainr expects a JSON array of objects - Malformed spec at index:" + index ); <END> } @SuppressWarnings( "unchecked" ) Map<String,Object> chainrEntryMap = (Map<String, Object>) chainrEntryObj; this.index = index; String opString = extractString( index, ChainrEntry.OPERATION_KEY, chainrEntryMap ); if ( opString == null ) { throw new SpecException( "JOLT Chainr spec index:" + index + " should define an 'operation' that is a transform or transform factory." ); } if ( STOCK_TRANSFORMS.containsKey( opString ) ) { operationString = opString; operationClassName = STOCK_TRANSFORMS.get( opString ); } else { operationString = null; operationClassName = opString; } transformClass = getTransformComponentClass(); spec = chainrEntryMap.get( ChainrEntry.SPEC_KEY ); isSpecDriven = SpecTransform.class.isAssignableFrom( transformClass ); if ( isSpecDriven && ! chainrEntryMap.containsKey( SPEC_KEY ) ) { throw new SpecException( "JOLT Chainr - operation:" + operationString + " implemented by className:" + transformClass.getCanonicalName() + " requires a spec." ); } }</code><technical_language>expecting a map instead of array</technical_language>

Target:
public ChainrEntry( int index, Object chainrEntryObj ) { if ( ! (chainrEntryObj instanceof Map ) ) { throw new SpecException( "JOLT ChainrEntry expects a JSON map - Malformed spec at index:" + index ); } @SuppressWarnings( "unchecked" ) Map<String,Object> chainrEntryMap = (Map<String, Object>) chainrEntryObj; this.index = index; String opString = extractString( index, ChainrEntry.OPERATION_KEY, chainrEntryMap ); if ( opString == null ) { throw new SpecException( "JOLT Chainr spec index:" + index + " should define an 'operation' that is a transform or transform factory." ); } if ( STOCK_TRANSFORMS.containsKey( opString ) ) { operationClassName = STOCK_TRANSFORMS.get( opString ); } else { operationClassName = opString; } transformClass = getTransformComponentClass(); spec = chainrEntryMap.get( ChainrEntry.SPEC_KEY ); isSpecDriven = SpecTransform.class.isAssignableFrom( transformClass ); if ( isSpecDriven && ! chainrEntryMap.containsKey( SPEC_KEY ) ) { throw new SpecException( "JOLT Chainr - Transform className:" + transformClass.getCanonicalName() + " requires a spec." ); } }